package org.example.springboot.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.sql.Timestamp;
import java.util.List;

/**
 * 图书分类实体类
 */
@Data
@Schema(description = "图书分类实体类")
public class BookCategory {
    @TableId(type = IdType.AUTO)
    @Schema(description = "分类ID")
    private Long id;
    
    @Schema(description = "分类名称")
    @NotBlank(message = "分类名称不能为空")
    @Size(max = 50, message = "分类名称长度不能超过50个字符")
    private String name;
    
    @Schema(description = "父分类ID")
    private Long parentId;
    
    @Schema(description = "排序号")
    private Integer sort;
    
    @Schema(description = "创建时间")
    private Timestamp createTime;
    
    @Schema(description = "更新时间")
    private Timestamp updateTime;
    
    @TableField(exist = false)
    @Schema(description = "子分类列表")
    private List<BookCategory> children;
} 